Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add limit to list workflows #377

Merged
merged 1 commit into from
Dec 6, 2024
Merged

Add limit to list workflows #377

merged 1 commit into from
Dec 6, 2024

Conversation

Sushisource
Copy link
Member

What was changed

Title

Why?

Convenience functionality since there's no built-in take function or similar in .NET for async iterators

Checklist

  1. Closes [Feature Request] ReplayWorkflowsAsync should take limit parameter #332

  2. How was this tested:
    Added test

  3. Any docs updates needed?

@@ -472,6 +473,11 @@ private async IAsyncEnumerable<WorkflowExecution> ListWorkflowsInternalAsync(
req, rpcOptsAndCancelSource.Item1).ConfigureAwait(false);
foreach (var exec in resp.Executions)
{
if (input.Options != null && input.Options.Limit > 0 &&
yielded++ >= input.Options.Limit)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the biggest fan of side effects in conditionals like this since postfix increment operator precedence is not always easy for a code reader to understand, but not a blocker.

@Sushisource Sushisource merged commit 66436bf into main Dec 6, 2024
8 checks passed
@Sushisource Sushisource deleted the list-workflows-limit branch December 6, 2024 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] ReplayWorkflowsAsync should take limit parameter
2 participants